<form class="normal_form" form-role="dialog" onsubmit="return Core.DialogForm(this)" style="padding-top:20px;margin-bottom:0;" autocomplete="off">
    <div class="row" style="margin-top:30px;">
        <div class="field_text">方案名称：</div>
        <input type="text" name="title" value="{$res['title'] ?? ''}" class="input-text require" style="width:220px;" placeholder="请输入方案名称" />
    </div>
    <div class="row" data-key="attn">
        <div class="field_text">上班打卡时间：</div>
        <input id="attns" name="attns" class="input-text time-spinner" min="00:00" max="23:59" value="{$res['attns'] ?? '00:00'}" showSeconds="false" style="width:108px;" placeholder="请配置时间" > 
        <!--
        <input id="attne" name="attne" class="input-text time-spinner" min="00:00" max="23:59" value="{$res['attne'] ?? '00:00'}" showSeconds="false" style="width:108px;" placeholder="请配置时间" >
        -->
    </div>
    <div class="row">
        <span style="color:gray;margin-left:105px;">上班时间必须晚于订单归档时间点 {$kdefer ?? ''}</span>
    </div>
    <div class="row form-footer-bar">
        <p class="colortip"></p>
        <button class="btn" role="btn-cancel">取消</button>
        <button class="btn btn-primary" type="submit" role="btn-submit">保存</button>
    </div>
</form>
<script type="text/javascript">
Core.DialogForm = function(form){    
    var form = $(form);
    var p = {
        'title'    : form.find(":text[name='title']").val(),
        'attns'    : form.find("#attns").val(),
        //'attne'    : form.find("#attne").val(),
    }
    if (!Core.rule('*',p['title'])) {
        form.find("p.colortip").html('请输入方案名称!');return false;
    }
    let t;
    let Tkeys = ['attns'];//,'attne'
    for(i in Tkeys) {
        t = {
            H : $('#'+Tkeys[i]).timespinner('getHours'),
            i : $('#'+Tkeys[i]).timespinner('getMinutes'),
        }
        if (p[Tkeys[i]] != '' && (!Core.rule('intps',t.H) || !Core.rule('intps',t.i))) {
            form.find("p.colortip").html('请配置正确的'+({"attns" : '上班',"attne" : '下班'}[Tkeys[i]] || '')+'时间点!');return false;
        }
    }
    
    form.find(":button").attr('disabled','disabled');
	$.ajax({type : "POST",dataType: "json",cache : false, url : "{$_G['_mc_'] ?? ''}/edit/id/{$res['id'] ?? ''}?r="+Math.random(),data : p,success: function(data){
	   try{
		   if (data['state'] == 'y'){
			   $("#datalist").datagrid('reload');$(form).dialogClose();
		   } else {
			   form.find(":button").removeAttr('disabled');form.find("p.colortip").html(data['msg']);return false;
		   }
	   }catch(e){form.find(":button").removeAttr('disabled');form.find("p.colortip").html('数据提交失败!');return false;}
	}});
	return false;
}
$(function(){
    Core.easyloaderInit();
});
</script>